package com.jonluo.rabbit.congif;


import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RabbitUtils {
    @Autowired
    private AmqpTemplate rabbitTemplate;


    /**
     * @param routingKey 路由key
     * @param message 发送的消息
     */
    public void send(String routingKey,Object message){
        this.rabbitTemplate.convertAndSend(routingKey, message);
    };

    /**
     *
     * @param exchange 交换机
     * @param routingKey 路由key
     * @param message 发送的消息
     */
    public void send(String exchange,String routingKey,Object message){
        this.rabbitTemplate.convertAndSend(exchange,routingKey, message);
    };


}
